package threading;

import java.util.Scanner;

class Counter1 {
     volatile public int count = 0;
}

public class Demo17 {
    public static void main(String[] args) {
        Counter1 counter1  = new Counter1();
        Thread t1 = new Thread(() -> {
            while(counter1.count == 0) {

            }
            System.out.println("t1线程结束!");
        });
        t1.start();

        Thread t2 = new Thread(()-> {
            System.out.println("请输入一个int:");
            Scanner scanner = new Scanner(System.in);
            counter1.count = scanner.nextInt();
        });
        t2.start();

    }
}
